<!-- 商品信息 -->
<template>
	<view class="container">
		<view class="content">
			<view class="name">舒绝死蚁饵剂红火蚁一窝端红火蚁专用药红蚂蚁杀蚁诱饵户外颗粒药</view>
			<view class="price-box">
				<text class="unit">￥</text>
				<text class="now">9.9</text>
				<text class="old">¥11.8</text>
			</view>
			<view class="others">
				<text class="label">月销量1000</text>
				<text class="label">库存850</text>
				<text class="label">好评95%</text>
				<button class="qrcode iconfont btn-transition-scale9" @click="handleShowQrcode()">&#xe60b;</button>
			</view>
		</view>
		
		<!-- 溯源二维码 -->
		<view class="qrcode-panel" v-if="qrcode.isShow">
			<view class="qrcode-content">
				<view class="qrcode">
					<image class="pic" :src="qrcode.url" mode="widthFix" show-menu-by-longpress></image>
					<text class="text">溯源码</text>
				</view>
				<button class="close-btn iconfont" @click="qrcode.isShow = false">&#xe60d;</button>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {ref} from 'vue';
	
	const qrcode = ref({
		isShow: false,
		url: '/pagesC-shopping/static/images/will-delete/qrcode.png',
	});
	
	// 显示溯源二维码
	const handleShowQrcode = (row) => {
		qrcode.value.isShow = true;
	}
</script>

<style lang="scss" scoped>
	.container {
		padding: 24rpx 25rpx 0;
		
		.content {
			padding: 24rpx 24rpx 26rpx 30rpx;
			background-color: white;
			border-radius: 20rpx;
			
			.name {
				display: block;
				font-weight: bold;
				font-size: 34rrpx;
				color: #222222;
				line-height: 1.5;
			}
			
			.price-box {
				display: flex;
				align-items: flex-end;
				margin-top: 14rpx;
				
				.unit {
					font-weight: 500;
					font-size: 26rpx;
					color: #FE3333;
					line-height: 1.3;
				}
				
				.now {
					font-weight: bold;
					font-size: 40rpx;
					color: #FE3333;
					line-height: 1;
				}
				
				.old {
					font-weight: 500;
					font-size: 26rpx;
					color: #999999;
					line-height: 1.3;
					text-decoration: line-through;
					margin-left: 14rpx;
				}
			}
		
			.others {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-top: 16rpx;
				
				.label {
					font-weight: 500;
					font-size: 22rpx;
					color: #999999;
				}
				
				.qrcode {
					font-size: 38rpx;
					color: #222222;
					background-color: transparent;
				}
			}
		}
	}
	
	.qrcode-panel {
		position: fixed;
		top: 0;
		left: 0;
		z-index: 9999;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.6);
	
		.qrcode-content {
			text-align: center;
	
			.qrcode {
				padding: 20rpx;
				border-radius: 10rpx;
				background-color: white;
	
				.pic {
					display: block;
					width: 400rpx;
					height: 400rpx;
				}
	
				.text {
					display: block;
					font-size: 24rpx;
					color: #222222;
					text-align: center;
					margin-top: 20rpx;
				}
			}
	
			.close-btn {
				display: inline-block;
				font-size: 30rpx;
				color: white;
				border: 5rpx solid white;
				border-radius: 50%;
				padding: 10rpx;
				margin-top: 50rpx;
				background-color: transparent;
			}
		}
	}
</style>